package com.example.hello;

import com.example.hello.client.Label.BootstrapLabelState;
import com.vaadin.ui.AbstractComponent;

public class BootstrapLabel extends AbstractComponent {

    public enum Type {
        DEFAULT, IMPORTANT, INFO, INVERSE, SUCCESS, WARNING
    }

    public BootstrapLabel() {
        this("");
    }

    public BootstrapLabel(String text) {
        this(text, Type.DEFAULT);
    }

    public BootstrapLabel(String text, Type type) {
        setText(text);
        setType(type);
    }

    @Override
    protected BootstrapLabelState getState() {
        return (BootstrapLabelState) super.getState();
    }

    public String getText() {
        return getState().getText();
    }

    public Type getType() {
        return Type.valueOf(getState().getType());
    }

    public void setText(String text) {
        getState().setText(text);
    }

    public void setType(Type type) {
        getState().setType(type.toString());
    }

}